package service;

import Pojo.QueryVo;
import Pojo.Solve;
import Pojo.Wrong;
import dao.SolveMapper;
import dao.WrongMapper;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class SolveServiceImpl
  implements SolveService
{

  @Autowired
  private SolveMapper solveMapper;

  @Autowired
  private WrongMapper wrongMapper;

  public List<Solve> selectall(QueryVo vo)
  {
    List list = this.solveMapper.selectall(vo);
    return list;
  }

  public Integer selectcount(QueryVo vo) {
    Integer count = this.solveMapper.selectcount(vo);
    return count;
  }

  public void deletesolve(Integer id) {
    this.solveMapper.deletesolve(id);
  }

  public List<Wrong> findwrong(QueryVo vo)
  {
    List list = this.wrongMapper.findwrong(vo);
    return list;
  }

  public Wrong findbyid(Integer id) {
    Wrong wrong = this.wrongMapper.findbyid(id);
    return wrong;
  }

  public void insertwrong(Wrong wrong) {
    wrong.setStatus("未处理");
    this.wrongMapper.insertwrong(wrong);
  }

  public void gotosolve(Integer id, Solve solve)
  {
    this.solveMapper.insertsolve(solve);
    this.wrongMapper.deletewrong(id);
  }
}